#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.demo.config;

import ${package}.demo.config.filter.ReactFilter;
import ${package}.demo.config.listener.ReactListener;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liuxw
 * @date 2019/4/1
 * @since 1.0
 */
@Configuration
public class ReactCommonConfig {


    /**
     * 配置 listener
     * @return
     */
    @Bean
    public ServletListenerRegistrationBean reactListener(){
        ServletListenerRegistrationBean listenerRegistrationBean = new ServletListenerRegistrationBean();
        listenerRegistrationBean.setListener(new ReactListener());
        return listenerRegistrationBean;
    }


    /**
     * 配置filter
     * @return
     */
    @Bean
    public FilterRegistrationBean reactFilter(){
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new ReactFilter());
        //设置filter匹配的规则
        registration.addUrlPatterns("/*");
        //设置filter执行的属性
        //registration.setOrder(2);
        return registration;
    }

}
